
	  Subroutine Sparse_Solver_MPI(Phase,Mtype,Right_Vector,Computed_Value)
	
	  Use Stiffness_Matrix_CSR,         ONLY: CSR_Matrix_Value,CSR_Row_Index,CSR_Matrix_Column
	  Use Global_Variables,			    ONLY: Neqns
      Use Constant,                     ONLY: Parallel_Threads
	  !use mkl_cluster_sparse_solver
   !   use mkl_spblas
      use mpi
	  Implicit None 
	  
	  Double Precision Right_Vector(Neqns)
	  Double Precision Computed_Value(Neqns)
	  Integer I
	  
!     ===========================The Variables Of Pardiso===========================
      Integer(Kind=8)           :: Pt(64)
	  Data                         Pt / 64*0 /			  ! Pointer Initialization
      Integer                   :: Maxfct, Mnum, Mtype, Phase, Nrhs, Error, Msglvl
      Integer                   :: Perm(Neqns)
      Integer                   :: Iparm(64),Comm
      Integer, External         :: Mkl_Get_Max_Threads
!     ===========================The Variables Of Pardiso===========================
	  
!     =========================== The Valuess Of Pardiso ===========================
      Maxfct   = 1
	  Mnum     = 1    
      Perm     = 0
	  Nrhs     = 1
      Iparm(1) = 0              ! Iparm Use Default Values
      Error    = 0  
      Msglvl   = 0
!     =========================== The Valuess Of Pardiso ===========================	 
	  
!	  Mtype    = 1                      ! Mtype = -2: Symmetric Nonpositive Definite Matrix, Mtype = 2: Symmetric Positive Definite Matrix	
	  Iparm(3) = Mkl_Get_Max_Threads()  ! Iparm(3): Parallel Threads Are Obtained By Mkl. In General, The Number Of Cpus Is The Same As The Number Of Threads
	  Iparm(3) = Min(Iparm(3),Parallel_Threads)
	  Comm     = 2                      ! MPI communicator. The solver uses the Fortran MPI communicator internally.  
      
      Iparm(60)=1            ! Auto switch for IC or OOC
      
	  If(Phase==12) Print *,'Start LU Decomposing With        ',Iparm(3),' Threads'
	  
	  !Call Pardiso( Pt, Maxfct, Mnum, Mtype, Phase, Neqns, CSR_Matrix_Value, CSR_Row_Index,   &
	  !              CSR_Matrix_Column, Perm, Nrhs, Iparm, Msglvl, Right_Vector, Computed_Value, Error )
	  Call Cluster_Sparse_Solver(Pt, Maxfct, Mnum, Mtype, Phase, Neqns, CSR_Matrix_Value, CSR_Row_Index,   &
		                         CSR_Matrix_Column, Perm, Nrhs, Iparm, Msglvl, Right_Vector, Computed_Value, Comm, Error)
      
      Select Case(Error)
	  Case (0)
!		 Print *,'Successfully Executed Pardiso with : *Phase =  ',Phase 
	  Case (-1)	
		 Call Termination('Error Occured in Executing Pardiso: input inconsistent')  
	  Case (-2)
		 Print *,'Not Enough Memory in Executed Pardiso: *Phase=',Phase   
         Call Termination('Error Occured in Executing Pardiso: not enough memory')        
	  Case (-3)
		 Call Termination('Error Occured in Executing Pardiso: reordering problem')
	  Case (-4)	
		 Call Termination('Error Occured in Executing Pardiso: Zero pivot')
	  Case (-5)
		 Call Termination('Error Occured in Executing Pardiso: unclassified (internal) error')
	  Case (-6)
		 Call Termination('Error Occured in Executing Pardiso: reordering failed')
	  Case (-7)		
		 Call Termination('Error Occured in Executing Pardiso: diagonal matrix is singular')
	  Case (-8)
		 Call Termination('Error Occured in Executing Pardiso: 32-bit integer overflow problem')
	  Case (-9)
		 Call Termination('Error Occured in Executing Pardiso: not enough memory for OOC') 
	  Case (-10)
		 Call Termination('Error Occured in Executing Pardiso: error opening OOC files')
	  Case (-11)
		 Call Termination('Error Occured in Executing Pardiso: read/write error with OOC files')
	  Case Default
	     Print *,'Error Occured in Executed Pardiso: *Phase=',Phase,' *Error=',Error
		 Call Termination('Error Occured in Executing Pardiso') 
	  End Select	

	  Return
      End